package com.winchain.chainbill.bill.biz.send.rx;

import com.shell.framework.rx.OnErrorNotImplementedSubscriber;
import com.winchain.chainbill.bill.base.po.CbRec;
import com.winchain.chainbill.bill.base.service.CbRecService;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.BillEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillRecordSubscriber<T> extends OnErrorNotImplementedSubscriber<BillEvent<T>> {
	@Autowired
	private CbRecService cbRecService;

	public void onApplicationEvent(BillEvent<T> t) {
		CbRec record = t.getBill().getRec();

		this.cbRecService.saveOrUpdate(record);
	}
}
